<?php
$className = "Groups";
/* 
 * The Groups class handles all information pertaining to
 * several groups such as getting a particular group from the database.
 */
class Groups {
    private $db = null;
    /**
     * Constructor of Groups class.
     * A Database object is needed to construct this class.
     * @param Database $db
     */
    public function  __construct($db) {
        $this->db = $db;
    }
    /**
     * If the admin group has already been created it is returned here.
     *
     * @return <type>
     */
    public function getAdminGroup() {
        $sql = "
            SELECT *
            FROM Groups
            WHERE name='Administrators'";
        $res = $this->db->getResult($sql);
        if(!$res)
            return(false);
        if(count($res) <= 0)
            return(false);
        @include_once('group.inc');
        $group = new Group($res[0]['ID'],$res[0]['name'],$res[0]['gRead'],$res[0]['gInsert'],$res[0]['gUpdate'],$res[0]['gCreate'],$res[0]['gDelete']);
        return($group);
    }
}
?>
